//
//  XYBottomView.swift
//  01-新浪微博
//
//  Created by 陈许亚 on 16/3/14.
//  Copyright © 2016年 cxy. All rights reserved.
//

import UIKit

class XYBottomView: UIView {
    //重写构造方法
    override init(frame: CGRect) {
        super.init(frame: frame)
        setUpUI()
    }
    //默认实现报错
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    //设置子控件
    private func setUpUI(){
//        backgroundColor = UIColor(white: 0.90, alpha: 1)
        backgroundColor = UIColor.whiteColor()
        addSubview(repostBtn)
        addSubview(commentBtn)
        addSubview(likeBtn)
        addSubview(sep1)
        addSubview(sep2)
        addSubview(sep3)
        addSubview(sep4)
        //转发
        repostBtn.snp_makeConstraints { (make) -> Void in
            make.left.equalTo(self.snp_left)
            make.top.equalTo(self.snp_top)
             make.bottom.equalTo(self.snp_bottom)

        }
        sep1.snp_makeConstraints { (make) -> Void in
            make.left.equalTo(repostBtn.snp_right)
//            make.top.bottom.equalTo(self)
            make.height.equalTo(self.snp_height).multipliedBy(0.4)
            make.centerY.equalTo(self.snp_centerY)
            make.width.equalTo(0.3)
        }

        //评论
        commentBtn.snp_makeConstraints { (make) -> Void in
            make.left.equalTo(repostBtn.snp_right)
            make.top.equalTo(self.snp_top)
            make.bottom.equalTo(self.snp_bottom)
            make.width.equalTo(repostBtn.snp_width)
        }
        sep2.snp_makeConstraints { (make) -> Void in
            make.left.equalTo(commentBtn.snp_right)
//            make.top.bottom.equalTo(self)
            make.height.equalTo(self.snp_height).multipliedBy(0.4)
            make.centerY.equalTo(self.snp_centerY)
            make.width.equalTo(0.3)
        }

        //点赞
        likeBtn.snp_makeConstraints { (make) -> Void in
            make.left.equalTo(commentBtn.snp_right)
            make.right.equalTo(self.snp_right)
            make.top.equalTo(self.snp_top)
            make.bottom.equalTo(self.snp_bottom)
            make.width.equalTo(commentBtn.snp_width)
        }
        self.snp_makeConstraints { (make) -> Void in
            make.bottom.equalTo(repostBtn.snp_bottom)
        }
        
        sep3.snp_makeConstraints { (make) -> Void in
            make.left.top.right.equalTo(self)
            make.height.equalTo(0.2)

        }
        sep4.snp_makeConstraints { (make) -> Void in
            make.left.bottom.right.equalTo(self)
            make.height.equalTo(0.2)
            
        }

        sep1.backgroundColor = UIColor.darkGrayColor()
        sep2.backgroundColor = UIColor.darkGrayColor()
//        sep3.backgroundColor = UIColor.darkGrayColor()
//        sep4.backgroundColor = UIColor.darkGrayColor()
        sep3.backgroundColor = UIColor(white: 0.9, alpha: 1)
        sep4.backgroundColor = UIColor(white: 0.9, alpha: 1)

    
    }

    //MARK:懒加载
    //转发
   lazy var repostBtn: UIButton = UIFactory.buttonWithTitle(nil, title: "转发", titleColor: UIColor.darkGrayColor(), fontSizeOfTitle: 12, imageName: "timeline_icon_retweet")
    //评论
    lazy var commentBtn: UIButton = UIFactory.buttonWithTitle(nil, title: "评论", titleColor: UIColor.darkGrayColor(), fontSizeOfTitle: 12,imageName: "timeline_icon_comment")
    //点赞
    lazy var likeBtn: UIButton = UIFactory.buttonWithTitle(nil, title: "赞", titleColor: UIColor.darkGrayColor(), fontSizeOfTitle: 12,imageName: "timeline_icon_unlike")
    
    //分界线
    lazy var sep1:UIView = UIView()
    lazy var sep2:UIView = UIView()
    lazy var sep3:UIView = UIView()
    lazy var sep4:UIView = UIView()


}
